<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use App\Zesow\WechatMini;

class NoSensitiveWord implements Rule
{
    public function passes($attribute, $value)
    {
        $app = WechatMini::getInstance();
        $result = $app->content_security->checkText($value);

        return $result['errcode'] != "87014";
    }

    public function message()
    {
        return ':attribute 包含敏感内容，请重新编辑';
    }
}